package com.tsystems.entities;

import java.io.Serializable;
import java.util.UUID;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;


@Entity
public class Ticket implements Serializable {
	private static final long serialVersionUID = 8642426917667148068L;
	
	
	@Id
	private String id;
	
	@PrePersist
	public void prepareId() {
		if (id == null) {
			id = UUID.randomUUID().toString();
		}
	}
	
	@ManyToOne
	private Passenger passenger;
	
	@ManyToOne
	private TimeTableElement timeTableElement;
		
	public Ticket() {

	}
	
	

	public Ticket(Passenger passenger, TimeTableElement timeTableElement) {
		this.passenger = passenger;
		this.timeTableElement = timeTableElement;
	}



	public Passenger getPassenger() {
		return passenger;
	}

	public void setPassenger(Passenger passenger) {
		this.passenger = passenger;
	}

	public TimeTableElement getTimeTableElement() {
		return timeTableElement;
	}

	public void setTimeTableElement(TimeTableElement timeTableElement) {
		this.timeTableElement = timeTableElement;
	}


	
	
		
}
